//Listing Passing by Value.
#include <cstdio>
#include <iostream>
#include "MyString.hpp"
using namespace std;
class Employee
{
public:
    Employee();
    Employee(char*, char*,char*,long);
    ~Employee();
    Employee(const Employee&);
    Employee& operator=(const Employee&);

    const String& GetFristName() const
    { return itsFirstName; }
    const String& GetLastName() const
    { return itsLastName; }
    const String& GetAddress() const
    { return itsAddress; }
    long GetSalary() const
    {
        return itsSalary; 
    }

    void SetFirstName(const String& fName)
    {
        itsFirstName = fName;
    }

    void SetLastName(const String& lName)
    {
        itsLastName = lName;
    }

    void SetAddress(const String& address)
    {
        itsAddress = address;
    }
    void SetSalary(long salary)
    {
         itsSalary = salary;
    }
private:
    String itsFirstName;
    String itsLastName;
    String itsAddress;
    long itsSalary;
};

Employee::Employee():
    itsFirstName(""),
    itsLastName(""),
    itsAddress(""),
    itsSalary(0)
{}

Employee::Employee(char* firstName, char* lastName, char* address, long salary):
    itsFirstName(firstName),
    itsLastName(lastName),
    itsAddress(address),
    itsSalary(salary)
{}

Employee::Employee(const Employee& rhs):
    itsFirstName(rhs.GetFristName()),
    itsLastName(rhs.GetLastName()),
    itsAddress(rhs.GetAddress()),
    itsSalary(rhs.GetSalary())
{}

Employee::Employee(const Employee& rhs):
    itsFirstName(rhs.GetFristName()),
    itsLastName(rhs.GetLastName()),
    itsAddress(rhs.GetAddress()),
    itsSalary(rhs.GetSalary())
{}

Employee::~Employee(){}

Employee& Employee::operator=(const Employee& rhs)
{
    if(this == &rhs)
    {
        return *this;
    }

    itsFirstName = rhs.GetFristName();
    itsLastName = rhs.GetLastName();
    itsAddress = rhs.GetAddress();
    itsSalary = rhs.GetSalary();

    return *this;
}

void PrintFunc(Employee);
void rPrintFunc(const Employee);
int main(void)
{
    Employee Edie("Jane","Doe","1461 Shore Parkway",20000);
    Edie.SetSalary(20000);
    Edie.SetFirstName("Edythe");
    Edie.SetLastName("LeVine");

    cout << "constructor count: ";
    cout << String::ConstructorCount << endl;
    rPrintFunc(Edie);
    cout << "Constructor count: ";
    cout << String::ConstructorCount << endl;
    PrintFunc(Edie);
    cout << "Constructor count: ";
    cout << String::ConstructorCount << endl;
    return 0;
}

void PrintFunc(Employee Edie)
{
    cout << "Name: ";
    cout << Edie.GetFristName().GetString();
    cout << " " << Edie.GetLastName().GetString();
    cout << ".\nAddress: ";
    cout << Edie.GetAddress().GetString();
    cout << "\nSalary: ";
    cout << Edie.GetSalary().GetString();
    cout << Edie.GetSalary();
    cout << endl;
}